package com.bootdo.clouddo.security;

import com.bootdo.clouddo.core.security.RedisAccessTokenStore;
import com.bootdo.clouddo.domain.user.QaUsers;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.provider.OAuth2Authentication;

/**
 * 装饰RedisAccessTokenStore，支持记录APP登录日志
 * 
 */
public class LogUserLastLoginRedisAccessTokenStore extends RedisAccessTokenStore {

	public LogUserLastLoginRedisAccessTokenStore() {}
	
	LogUserLastLoginRedisAccessTokenStore(String appScopeKey){
		super(appScopeKey);
	}

	@Override
	public OAuth2AccessToken getAccessToken(OAuth2Authentication authentication) {
		QaUsers user = (QaUsers) authentication.getPrincipal();
		//if(user != null)
			//restTemplate.put(server+"normaluser/updateLastLoginTimeById/APP/{id}", null,user.getUid());
		return super.getAccessToken(authentication);
	}

}
